import React from 'react';
import {Button, message} from "antd";
import {useSelector} from "react-redux";
import {useNavigate} from "react-router-dom";

/**
 * 添加问答
 * @param props
 * @returns {Element}
 * @constructor
 */
function AddIssueBtn(props) {
    const {isLogin} = useSelector(state=> state.user)
    const navigatie = useNavigate()
    const handleClick = () => {
        if (isLogin) {
            // 跳转
            navigatie('/addIssue')
        } else{
            message.error('请先登录')
        }
    }
    return (
        <Button style={{width: '100%'}} type="primary" size="large" onClick={handleClick}>我要发问</Button>
    );
}

export default AddIssueBtn;